package com.zhao.service.serviceImpl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhao.mapper.FileCommentMapper;
import com.zhao.pojo.FileComment;
import com.zhao.service.FileCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FileCommentServiceImpl extends ServiceImpl<FileCommentMapper, FileComment> implements FileCommentService {
    @Autowired
    FileCommentMapper fileCommentMapper;

    @Override
    public List<FileComment> allComment(Integer id) {
        List<FileComment> fileComments = fileCommentMapper.allComment(id, 0);
        for (FileComment fileComment:fileComments) {
             fileComment.setSons(fileCommentMapper.allComment(null, fileComment.getId()));
        }
        return fileComments;
    }
}
